/*    */
package handling.world.party;
/*    */
/*    */

import handling.world.WorldPartyService;
import server.Timer;

import java.util.concurrent.ScheduledFuture;

/*    */
/*    */

/*    */
/*    */
/*    */ public class PartySearch
        /*    */ {
    /*    */   private final String name;
    /*    */   private final int partyId;
    /*    */   private final PartySearchType pst;
    /*    */   private ScheduledFuture<?> removal;

    /*    */
    /*    */
    public PartySearch(String name, int partyId, PartySearchType pst) {
        /* 16 */
        this.name = name;
        /* 17 */
        this.partyId = partyId;
        /* 18 */
        this.pst = pst;
        /* 19 */
        scheduleRemoval();
        /*    */
    }

    /*    */
    /*    */
    public PartySearchType getType() {
        /* 23 */
        return this.pst;
        /*    */
    }

    /*    */
    /*    */
    public int getId() {
        /* 27 */
        return this.partyId;
        /*    */
    }

    /*    */
    /*    */
    public String getName() {
        /* 31 */
        return this.name;
        /*    */
    }

    /*    */
    /*    */
    public final void scheduleRemoval() {
        /* 35 */
        cancelRemoval();
        /* 36 */
        this.removal = Timer.EtcTimer.getInstance().schedule(() -> {
            String msg = "超出限制时间，组队广告已被删除。";
            if (this.pst.exped) msg = "超出限制时间，远征队广告已被删除。";
            WorldPartyService.getInstance().removeSearch(this, msg);
        }, (this.pst.timeLimit * 60 * 1000));
    }

    /*    */
    /*    */
    /*    */
    /*    */
    /*    */
    /*    */
    /*    */
    /*    */
    public void cancelRemoval() {
        /* 46 */
        if (this.removal != null) {
            /* 47 */
            this.removal.cancel(false);
            /* 48 */
            this.removal = null;
            /*    */
        }
        /*    */
    }
    /*    */
}


/* Location:              C:\PGX\Server.jar!\handling\world\party\PartySearch.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */